{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "51cd4fa7-6075-49af-9a1c-e6c692692cdd",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/jump-game\n",
    "\n",
    "\n",
    "Time Limit Exceeded\n",
    "\n",
    "\n",
    "```python\n",
    "class Solution:\n",
    "    def canJump(self, nums: List[int]) -> bool:\n",
    "        #8:52\n",
    "        if len(nums) == 1:\n",
    "            return True\n",
    "\n",
    "        def recursive_jump(i):\n",
    "            if (nums[i] == 0):\n",
    "                return False\n",
    "            else:\n",
    "                result_list = []\n",
    "                \n",
    "                for n in range(1, nums[i] + 1):\n",
    "                    new_i = i+n\n",
    "                    if new_i == len(nums)-1:\n",
    "                        result_list.append(True)\n",
    "                    elif new_i < len(nums)-1:\n",
    "                        result_list.append(recursive_jump(new_i))\n",
    "                    else:\n",
    "                        result_list.append(True)\n",
    "                \n",
    "                return any(result_list)\n",
    "        \n",
    "        if nums[0] == 0:\n",
    "            return False\n",
    "            \n",
    "        return recursive_jump(0)\n",
    "        #9:01\n",
    "        #debug a whole day (not exactly a whole day...I'm just kiding, but at least two hours during the day)\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5dee5dda-ce1f-4917-99e6-6866846c762e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
